programming4us
           
 
 
SQL Server

Protecting SQL Server Data : SCHEMA ARCHITECTURE STRATEGIES - Using Database Object Schemas

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
7/19/2011 4:46:29 PM
Throughout this article the word "schema" has been used as a general term to describe the database architecture and its objects. However, in SQL Server the term schema, or more formally Database Object Schema, refers to the namespace, or container, in which database objects reside. Inside the database object schemas are database objects, such as tables, views and stored procedures, which can be grouped together logically. This offers a way to organize your database objects and control access to them at a group level.

When a user is denied access to a database object schema, they cannot view or access any of the database objects within it. This offers a level of obscurity to portions of the overall database schema design and can be used to separate highly sensitive data from less sensitive data. Figure 1 illustrates how a user may have access to one database object schema, in this case the default database object schema of dbo, while being denied to all objects within another database object schema, here, the Income_Schema database object schema.

Figure 1. A user with permissions to the default database object schema while being denied access to the Income_Schema database object schema.

Database object schemas offer an effective method of protecting sensitive data through separation, and can also make permission management less of a headache to the DBA. To create a database object schema in a database the CREATE SCHEMA method will be executed in SQL Server Management Studio. The following is an example of the syntax of this method:

CREATE SCHEMA [Schema Name] AUTHORIZATION [Schema Owner]

This method's arguments are:

  • Schema name: This is the textual reference to the database object schema.

  • Authorization: This is the textual reference to the schema owner. This argument is optional. When this argument is not included the user creating the database object schema is set as the object owner.

In the HomeLending database, the only role that we want to allow to modify database objects, or set permissions, in the Income_Schema schema is the Database Role of db_owner. Therefore, the statement that was used to create the Income_Schema schema includes the AUTHORIZATION argument, as shown in Listing 1.

Listing 1. Creating the Income_Schema database object schema.

Having created the database object schema, we can use the GRANT, DENY and REVOKE statements to manage permissions to that schema, in a similar fashion to the manner in which we've previously used them to manage permissions to database objects.

An example of the syntax used to grant SELECT, INSERT and UPDATE privileges to the Sensitive_high Database Role for the Income_Schema database object schema, is shown in Listing 2.

Listing 2. Granting permission to select, insert and update data in Income_Schema to the Sensitive_high database role.

Notice the two colons (::) used in reference to the schema. This is a scope qualifier. A scope qualifier defines that the permissions are restricted to a specific object type. In this case, we defined the object type to be a schema and then reference the schema on which we wish to grant permissions.

When referencing database objects, it is good practice to refer to them with their fully qualified name, which will include a reference to the database object schema in which the object resides. When the database object schema is not included, SQL Server will search the database user's default database object schema to try to find the database object that is being referenced; if the database object is not found an error will be returned stating that the object is invalid.

Listing 3 shows a sample query in which the fully qualified names of the tables in the default database object schema, which is dbo, and the Income_Schema schema, are referenced.

Listing 3. Using fully qualified database object names.
Other -----------------
- Protecting SQL Server Data : SCHEMA ARCHITECTURE STRATEGIES - Protection via Normalization
- Troubleshooting and Optimizing SQL Server 2005 : Server Configuration Maintenance
- Troubleshooting and Optimizing SQL Server 2005 : Tuning the Database Structure
- Troubleshooting and Optimizing SQL Server 2005 : Data Analysis and Problem Diagnosis
- SQL Injection Attacks and Defense : Exploiting the Operating System - Consolidating Access
- SQL Injection Attacks and Defense : Executing Operating System Commands
- Administering SQL Server 2008 with PowerShell : PowerShell Scripting Basics (part 2)
- Administering SQL Server 2008 with PowerShell : PowerShell Scripting Basics (part 1)
- Administering SQL Server 2008 with PowerShell : Overview of PowerShell
- SQL Server 2008 Scheduling and Notification : Scripting Jobs and Alerts, Multiserver Job Management & Event Forwarding
- SQL Server 2008 Scheduling and Notification : Managing Alerts
- SQL Injection Attacks and Defense : Accessing the File System (part 2) - Writing Files
- SQL Injection Attacks and Defense : Accessing the File System (part 1) - Reading Files
- SQL Server 2008 Scheduling and Notification : Managing Jobs
- SQL Server 2008 Scheduling and Notification : Managing Operators
- SQL Server 2008 Scheduling and Notification : Configuring the SQL Server Agent
- SQL Server 2008 : Database Mail - Related Views and Procedures
- SQL Server 2008 : Database Mail - Using SQL Server Agent Mail
- SQL Server 2008 : Sending and Receiving with Database Mail
- SQL Server 2008 : Setting Up Database Mail
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us